<?php
namespace app\controllers;
use Yii;
use yii\web\Controller;
class LoginController extends Controller
{
    public function actionIndex(){
        echo $this->renderPartial('/login/index');
    }
    public function actionCheckuser() {
        $name = trim(Yii::$app->request->post("name"));
        $pass = trim(Yii::$app->request->post("passwd"));
        if ($name != 'tuyinai' && $pass != 'ty&ty!') {
            return 100;
        }
        session_start();
        $_SESSION['user'] = md5($pass.$name);
        return 200;
    }
    public function actionLogout(){
        session_start();
        unset($_SESSION['user']);
        header("Location:/login");
        exit;
    }
}